<?php
//判断sign
if ( empty($_COOKIE['sign']) ){

	$str ="<script type='text/javascript'>";
	$str .="window.location.href='login.html'";
	$str .="</script>";
	echo $str;	exit;
}else if($_COOKIE['sign']== "null" || $_COOKIE['sign']== "undefine"){
	$str ="<script type='text/javascript'>";
	$str .="window.location.href='login.html'";
	$str .="</script>";
	echo $str;	exit;
}
// if ( $_COOKIE['sign']== "null"){
	
//
// 	if ( empty($_COOKIE['sign']) ){
//
// 	$str ="<script type='text/javascript'>";
// 	$str .="window.location.href='login.html'";
// 	$str .="</script>";
// 	echo $str;	exit;
// }else if($_COOKIE['sign']== "null" || $_COOKIE['sign']== "undefine"){
// 	$str ="<script type='text/javascript'>";
// 	$str .="window.location.href='login.html'";
// 	$str .="</script>";
// 	echo $str;	exit;
// }}
// $sign=$_COOKIE['sign'];
// $sign="579fSSXRSq1Y7gWaLXM\/d56jRWcVuQTC5H1B8IDPowcwt0oSCS5TCeBSxbSVBAbzVbR8yhJJ5qjyfxMbUm2wPWa3ZJB81wGmp7QNykPpDwvVhPnYg8u7TpCAaa3dIZMZDhPqUa3JOKBKZh45";
// $re=f_send_msg("http://sl.deeyi.com/ws/dy/ci/index.php/sype/limit/?sign=$sign",'m='.php_self());

$sign= $_COOKIE['sign'];
$sign = str_replace('%2B', '+', $sign);
$sign = str_replace('%22', '"', $sign);
$sign = str_replace('%27', "'", $sign);
$sign = str_replace('%2F', '/', $sign);
$sign=urlencode($sign);

$re=f_send_msg("http://sl.deeyi.com/ws/dy/ci/index.php/sype/limit/?sign=$sign",'m='.php_self());

$re=json_decode($re);
// var_dump($re);exit;
// echo $sign;exit;

if($re->ok){
  $str ="<script type='text/javascript'>";
  		$str .="var p_sqx='".$re->sqx."';";
  		$str .="</script>";
  		echo $str;
}else{
  require("404.php");
  exit;
}



if(!$re->ok){
   require("404.php");
   //echo($errpage);
  //echo $re->msg;
  exit;
}


//echo php_self();exit;

function php_self(){
    $php_self=substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1);
    return $php_self;
}

function f_send_msg($url,$post_data){
	// var_dump($post_data);exit;
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
	curl_setopt($ch, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
	curl_setopt($ch, CURLOPT_POST,true);
	curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
	$res = curl_exec($ch);
	curl_close($ch);
	return $res;
}

?>
